package com.wg.msshopsp.backendmanagement.order.controller;

import com.wg.msshopsp.backendmanagement.order.entity.OrderVO;
import com.wg.msshopsp.backendmanagement.order.service.OrderVOService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class OrderVOController {
    @Autowired
    private OrderVOService orderVOService;

    @GetMapping("/shop/selectBySellerId")
    @Operation(summary = "商家查询订单")
    public List<OrderVO> selectBySellerId(@RequestParam Long sellerId) {
        return orderVOService.selectBySellerId(sellerId);
    }


    @PutMapping("/shop/updateOrderStatus")
    @Operation(summary = "商家更新订单状态")
    public int updateOrderStatus(@RequestParam Long orderId, @RequestParam Integer newStatus, @RequestParam Long sellerId) {
        return orderVOService.updateOrderStatus(orderId, newStatus, sellerId);
    }


    @DeleteMapping("/shop/deleteOrder")
    @Operation(summary = "商家删除订单")
    public int deleteOrder(@RequestParam Long orderId, @RequestParam Long sellerId) {
        return orderVOService.deleteOrder(orderId, sellerId);
    }
}
